package com.zhouyu;

import com.zhouyu.aspect.bean.User;
import com.zhouyu.bean.LifeCycle;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;

/**
 * @author dl.chai
 * @version 1.0
 * @description: Application
 * @date 2023/4/10 20:37
 */

public class Application {

	public static void main(String[] args){
		AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
		//将 LifeCycle 注册到容器中
		applicationContext.register(Application.class);
		applicationContext.refresh();

		// 关闭上下文，触发销毁操作
		applicationContext.close();
	}

	@Bean(initMethod = "initMethod", destroyMethod = "destroyMethod")
	public LifeCycle lifeCycle(){
		return new LifeCycle();
	}

	@Bean
	public User user(){
		return new User();
	}

}
